<?php
include 'base.php';
include 'requireLogin.php';
include 'connectdb.php';
?>
<?php
if (isset($_POST['add_product_button'])){
    $varDate = $_POST['a_date'];
    $varDate1= $_POST['i_date'];
    $stSQL="SELECT bill.*,product.* FROM bill,product Where bill.date <'" .$varDate. "' and bill.date >'" .$varDate1."' and product.code = bill.product_code";
    $result=mysql_query($stSQL);
    while($row = mysql_fetch_array($result))
    {     
    	//$temp = $row['quantity']*$row['sale_price']-$row['quantity']*$row['sale_price']*$row['discount'];
       // $sum = $sum+$temp;
        echo"<table border='1'>
        <tr>
        <th>Mã hóa đơn</th>
        <th>Mã sản phẩm</th>
        <th>Số lượng</th>
        <th>Mã khách hàng</th>
        <th>Mã nhân viên</th>
        <th>Khuyến mãi</th>
        <th>Kiểu</th>
        <th>Ngày</th>
        </tr>";
        echo "<tr>";
        echo"<td>".$row['code']. "</td>";
        echo"<td>".$row['product_code']. "</td>";
        echo"<td>".$row['quantity']. "</td>";
        echo"<td>".$row['customer_code']. "</td>";
        echo"<td>".$row['seller_code']. "</td>";
        echo"<td>".$row['discount']. "</td>";
        echo"<td>".$row['type']. "</td>";
        echo"<td>".$row['date']. "</td>";
        echo "</tr>";
        echo"</table>";
    }
}
?>
<form method="post" action="">
        <div class="form_settings">                    
            <p> <span>Thống kê từ :</span><input type="text" name="i_date" id = "i_date"></p>
            <p> <span>Đến trước ngày :</span><input type="text" name="a_date" id = "a_date" value ="<?php echo date("Y-m-d");?>"></p>
            <span>&nbsp;</span><input class="submit" type="submit" id = "submit" name="add_product_button" value="Nhập ngày" />
        </div>
</form>    
<?php include 'footer.php';?>
